﻿using System;
using System.Windows;
using System.Windows.Resources;
using System.Windows.Markup;
using System.IO;
using System.Reflection;
using System.Resources;

namespace Alma.Library.Helper
{
    public class XamlHelper
    {
        public static T LoadXamlFromUri<T>(string uri)
        {
            string xaml = string.Empty;
            StreamResourceInfo sri = Application.GetResourceStream(new Uri(uri, false));
            using (StreamReader sr = new StreamReader(sri.Stream))
            {
                xaml = sr.ReadToEnd();
            }
            T shape = (T)XamlReader.Parse(xaml);
            return shape;
        }
    }
}
